import { defineStore } from 'pinia'
import { mygetUnitTree } from "../api/abbNewApi";
// 使用 `defineStore` 定义 Store
export const useCounterStore = defineStore('counter', {
  state: () => ({
    count: 0,
    whetherLogin: false,
    eidtPasswordval: false,//是否修改密码
    mydataType: [],
    getNowUnit: {},
  }),
  getters: {
    doubleCount: (state) => state.count * 2
  },
  actions: {
    increment() {
      this.count++
    },
    setUnit() {
      mygetUnitTree().then(res => {
        if (res.success) {
          this.getNowUnit = res.data
        }
      })
    },
    //判断是否登录
    setwhetherLogin(val) {
        this.whetherLogin = val
    },
    setmima(data) {
		this.eidtPasswordval = data
    },
    setDataType(val) {
        this.mydataType = val
    },
  }
})
